/*
 * Copyright (C) 2012 JiangHongTiao
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.paris.core.persistence;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import org.apache.log4j.Logger;
import sk.lieskove.jianghongtiao.common.utils.PropertiesUtils;
import sk.lieskove.jianghongtiao.websearch.document.preprocessing.SupportedLanguages;

/**
 * 
 * @author xjuraj e-mail: jjurco.sk_gmail.com
 */
@Entity
public class TrainSet implements Serializable {
    
    private transient Logger log = Logger.getLogger(TestSet.class);
    private transient PropertiesUtils pu = new PropertiesUtils(TestSet.class);
    
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE)
    private Long id;
    private String[] classes;
    @Enumerated(EnumType.STRING)
    private SupportedLanguages lang;
    private Double baseline;
    
    @OneToMany(fetch= FetchType.EAGER, cascade= CascadeType.PERSIST)
    private Collection<TrainSetClassificationStorage> trainSetClassificationStorage;

    public TrainSet() {
    }
    
    public TrainSet copy(){
        TrainSet trainSet = new TrainSet();
        trainSet.baseline = baseline;
        trainSet.classes = classes;
        trainSet.lang = lang;
        trainSet.trainSetClassificationStorage = new ArrayList<TrainSetClassificationStorage>();
        for (TrainSetClassificationStorage item : trainSetClassificationStorage) {
            trainSet.trainSetClassificationStorage.add(item.copy());
        }
        return trainSet;
    }

    public Double getBaseline() {
        return baseline;
    }

    public void setBaseline(Double baseline) {
        this.baseline = baseline;
    }

    public String[] getClasses() {
        return classes;
    }

    public void setClasses(String[] classes) {
        this.classes = classes;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public SupportedLanguages getLang() {
        return lang;
    }

    public void setLang(SupportedLanguages lang) {
        this.lang = lang;
    }

    public Collection<TrainSetClassificationStorage> getTrainSetClassificationStorage() {
        return trainSetClassificationStorage;
    }

    public void setTrainSetClassificationStorage(Collection<TrainSetClassificationStorage> trainSetClassificationStorage) {
        this.trainSetClassificationStorage = trainSetClassificationStorage;
    }

}
